import { createApp } from 'vue'

import { createPinia } from 'pinia'
import 'virtual:svg-icons-register'

// 引入vant组件样式
// import 'vant/lib/index.css'
// 备注: unplugin-vue-components插件已经自动导入组件和样式了，只需要导入函数式组件的样式即可，否则会重复导入导致部分组件样式异常的问题
import 'vant/es/toast/style'
import 'vant/es/dialog/style'
import 'vant/es/notify/style'
import 'vant/es/image-preview/style'
import { Dialog } from 'vant'
import { Calendar, PullRefresh, List, Empty } from 'vant'
// 全局样式
import '@/styles/index.less'
import ElementPlus from 'element-plus'
// 引入echarts
import * as echarts from 'echarts'
import { Icon } from 'vant'
import router from '@/router'

// 路由守卫，动态路由处理
import '@/router/router-guards'
import App from './App.vue'

import 'element-plus/dist/index.css'
import '@/utils/vconsole'

import '@vant/touch-emulator'

const app = createApp(App)
app.config.errorHandler = (err, instance, info) => {
  console.error(err, instance, info)
}

// 注册
app.config.globalProperties.$echarts = echarts
const store = createPinia()

app
  .use(router)
  .use(Icon)
  .use(ElementPlus)
  .use(store)
  .use(Dialog)
  .use(Calendar)
  .use(List)
  .use(PullRefresh)
  .use(Empty)
  .mount('#app')
